package com.retailtouch.client.managed.ui;

import com.google.gwt.requestfactory.ui.client.ProxyRenderer;

import com.retailtouch.client.managed.request.ItemsProxy;

/**
 * Renders {@link ItemsProxy for display to the user. Requires the
 *  properties to have been fetched.
 */
public class ItemsProxyRenderer extends ProxyRenderer<ItemsProxy> {
  private static ItemsProxyRenderer INSTANCE;

  public static ItemsProxyRenderer instance() {
    if (INSTANCE == null) {
      INSTANCE = new ItemsProxyRenderer();
    }

    return INSTANCE;
  }

  protected ItemsProxyRenderer() {
    super(new String[] {"id"});
  }

  public String render(ItemsProxy object) {
    if (object == null) {
      return "";
    }
    return object.getId() + " (" + object.getId() + ")";
  }
}
